package net.didactylos.helpline.stripes.validation;

import java.util.Collection;
import java.util.Locale;

import org.hibernate.classic.Session;

import net.didactylos.helpline.data.*;
import net.didactylos.helpline.servlet.HibernateUtil;
import net.sourceforge.stripes.validation.*;

public class ConversationConverter implements TypeConverter<Conversation>
{

	public Conversation convert(String input, Class<? extends Conversation> targetType, Collection<ValidationError> errors)
	{
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		return (Conversation) session.get(Conversation.class, Long.parseLong(input));
	}

	public void setLocale(Locale locale)
	{
		// Do nothing.
	}

}
